<?php
$this->breadcrumbs=array(
	'Papers'=>array('index'),
	'Create',
);

$this->menu=array(
	array('label'=>'List paper', 'url'=>array('index')),
	array('label'=>'Manage paper', 'url'=>array('admin')),
);
?>

<h1>Create paper</h1>

<div class="yiiForm">


<?php 

$JFV=Yii::app()->jformvalidate;

$JFV->setOptions(array(
		'errorElement'=> 'div',
		'errorClass' => 'invalid',
        ));



echo $JFV->form();

?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo Html::errorSummary($model); ?>

	<div class="row">
		<?php echo Html::activeLabel($model,'title'); ?>
		<?php echo $JFV->activeTextField($model,'title',array('size'=>60,'maxlength'=>200)); ?>
		
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,'author'); ?>
		<?php echo $JFV->activeTextField($model,'author'); ?>
		
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,'language'); ?>
		<?php echo $JFV->activeTextField($model,'language',array('size'=>3,'maxlength'=>3)); ?>
		
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,'description'); ?>
		<?php echo $JFV->activeTextField($model,'description',array('size'=>60,'maxlength'=>250)); ?>
		
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,'content'); ?>
		<?php echo $JFV->activeTextField($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,'tags'); ?>
		<?php echo $JFV->activeTextField($model,'tags',array('rows'=>6, 'cols'=>50)); ?>
		
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,'image'); ?>
		<?php echo $JFV->activeTextField($model,'image',array('size'=>60,'maxlength'=>100)); ?>
		
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,'created'); ?>
		<?php echo $JFV->activeTextField($model,'created'); ?>
		
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array('class'=>'submit')); ?>
	</div>


<?php echo $JFV->endForm(); ?>

</div><!-- form -->
<script type="text/javascript">
$('form').bind('submit', function() { console.log('submit');return false; });

$('.submit').bind('click', function () {
console.log('clicked');
  jQuery.ajax({
beforeSend: function(xhr) { 
            xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 
            return true; 
        },
'type':'POST',
'url': jQuery(this).parents("form").attr("action"),
'cache':false,
'data':jQuery(this).parents("form").serialize(),
'success':function(html){
jQuery('#content').html(html)}
});
  return false;
});

</script>



